package org.example.product.service.impl;

import org.example.product.dao.BrandCategoryDao;
import org.example.product.service.BrandCategoryService;
import org.example.product.vo.BrandVo;
import org.example.product.vo.RelateCategoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 小杰_cc
 * @version 1.0
 */
@Service("brandCategoryService")
public class BrandCategoryServiceImpl implements BrandCategoryService {

    @Autowired
    private BrandCategoryDao brandCategoryDao;

    // 添加品牌分类关系
    @Override
    public int saveBrandCategory(Long brandId, Long categoryId) {
        return brandCategoryDao.saveBrandCategory(brandId,categoryId);
    }

    // 根据品牌id获取关联的分类
    @Override
    public List<RelateCategoryVo> queryCategoryListByBrandId(Long brandId) {
        return brandCategoryDao.getCategoryListByBrandId(brandId);
    }

    // 删除品牌分类信息
    @Override
    public int deleteBrandCategory(Long id) {
        return brandCategoryDao.removeBrandCategory(id);
    }

    // 根据分类id获取品牌集合
    @Override
    public List<BrandVo> queryBrandListByCategoryId(Long categoryId) {

        return brandCategoryDao.getBrandListByCategoryId(categoryId);
    }

    @Override
    public void deleteByCategoryIds(List<Long> ids) {
        brandCategoryDao.deleteByCategoryIds(ids);
    }

    @Override
    public void deleteByBrandIds(List<Long> ids) {
        brandCategoryDao.deleteByBrandIds(ids);
    }
}